package com.grq.framework.core.exception;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.view.RedirectView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public interface GrqWebExceptionHandler {

    /**
     * 未登录异常
     * 401
     *
     * @return
     */
    RedirectView notLoginException(RuntimeException e, HttpServletResponse response, HttpServletRequest request);


    /**
     * 无权限异常
     * 403
     *
     * @return
     */
    ModelAndView notPermissionException(RuntimeException e, HttpServletResponse response);

    /**
     * 无角色异常
     * 403
     *
     * @return
     */
    ModelAndView notRoleException(RuntimeException e, HttpServletResponse response);

    /**
     * 业务异常
     * 500
     */
    ModelAndView businessException(BusinessException e, HttpServletResponse response);

    /**
     * 处理通用异常
     * 500
     *
     * @param e
     * @return
     */
    ModelAndView exception(Exception e, HttpServletResponse response);

}
